import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class MyThreadPoolExecutor {
    private BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(100);
    public MyThreadPoolExecutor(int num) {
        for(int i = 0 ; i < num; i++) {
            new Thread(() -> {
                while(true) {
                    try {
                        queue.take().run();
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }).start();
        }
    }
    public void submit(Runnable runnable) throws InterruptedException {
        queue.put(runnable);
    }
}